<?php
require_once("loginView.php");
require_once(CORE_DIR.'userModel.php');

class logoutAction extends Action{

	function __construct(){
		$this->view = new loginView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);

		$uModel = new userModel();
		
		$activeUser = $uModel->getActiveUser(); 

		$this->logger->addLog("cmd: LOGOUT session: ".session_id()." user: ".$activeUser->getId()."|".$activeUser->getNickName(), Logger::DEBUG_LEVEL);
		
		$uModel->removeAutologinData();
		$uModel->CloseDBConnection();
		session_destroy();
		
		$this->view->showLogout();
	}
}
?>